package com.iwinding.ladygg.net.callback;


import android.content.Context;
import android.text.TextUtils;

import com.iwinding.ladygg.constant.SPConstant;
import com.iwinding.ladygg.net.response.BaseRopnse;
import com.iwinding.ladygg.net.response.LoginRp;
import com.iwinding.ladygg.utils.GsonUtil;
import com.iwinding.ladygg.utils.LogUtil;
import com.iwinding.ladygg.utils.SPUtils;


/**
 * Created by hezhiyong on 2017/3/24.
 */

public abstract class LoginCallback extends BaseRpCallback<LoginRp> {

    private Context mContext;

    public LoginCallback(Context mContext){
        this.mContext = mContext;
    }

    @Override
    public LoginRp parseResponse(BaseRopnse response, int id) {
        if(!TextUtils.isEmpty(response.cookie)){
            SPUtils.putSpProperty(mContext, SPConstant.COOKIE,response.cookie);
        }
        LogUtil.i("@hzy", "icane----Login:" );
        LoginRp rp = GsonUtil.getInstance().formJson(response.data, LoginRp.class);
        return rp;
    }
}